<%@ page contentType="text/html;charset=UTF-8" %>

<!DOCTYPE html>
<html>
<head>
	<title>应用设置</title>
	 <%@ include file="/common/meta.jsp" %>
	<%@ include file="/common/import.jsp" %>
	<script type="text/javascript" src="${ctx}/js/zbxtools.js"></script>
	
	<script type="text/javascript">
		var inputForm = '#inputForm';
		$(function(){
			$(inputForm).form({
			    onSubmit:function(){		    	
			    	return $(this).form('validate');
			    },
			    success:function(data){
			    	var result = jQuery.parseJSON(data);
			    	if(result.flag=='T'){
			    		$.messager.alert('提交结果', '操作成功', 'info',function(){
			    			parent.colseAdd();
			    			parent.reload();
			    		});
			    		$('#sysId').val(result.msg);
			    		
			    	}else if(result.flag=='H'){//有子列表时，提示不能修改标识
			    		$.messager.alert('提交结果', result.msg, 'info');
			    	}else{
			    		$.messager.alert('提交结果', '操作失败', 'error');
			    	}        
			    }
			});
		}) ;
	</script>

<body>	

<div id="tip"></div>
	<form id="inputForm" name="inputForm" method="post" action="save.action">
		<input type="hidden" name="formToken" id="formToken" value="${formToken}"/>
		<input type="hidden" name="isAdd" value="${isAdd}"/>
		<input type="hidden" name="sysId" id="sysId" value="${item.sysId}"/>
		<input type="hidden" name="oldSysEname" id="oldSysEname" value="${item.sysEname}"/>
		<table class="datagrid-body" >
			<tr >
				<td class="datagrid-header">应用名称<font color="red">*</font></td>
				<td>
					<input name="sysCname"  id="sysCname" value="${item.sysCname}"
					class="easyui-validatebox" style="width:220px;" data-options="required:true,validType:'length[2,30]'"
					missingMessage="请输入应用名称" invalidMessage="应为2~30个字" />				
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">应用标识<font color="red">*</font></td>
				<td>
					<input id="sysEname" name="sysEname"  value="${item.sysEname}"
					class="easyui-validatebox" data-options="required:true,validType:'length[2,30]'" style="width:220px;" 
					missingMessage="应用标识，用字母组合" invalidMessage="应为2~30个字" />
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">应用密码<font color="red">*</font></td>
				<td>
					<input type="password" id="sysPass" name="sysPass"  value="${item.sysPass}"
					class="easyui-validatebox" data-options="required:true,validType:'length[2,30]'" style="width:220px;" 
					missingMessage="应用密码，用字母组合" invalidMessage="应为2~30个字" />
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">限定ip</td>
				<td>
					<input id="sysAllowIp" name="sysAllowIp"  value="${item.sysAllowIp}"
					class="easyui-validatebox"  style="width:220px;"  
					  />
				</td>
			</tr>		
			<tr>
				<td class="datagrid-header">状态<font color="red">*</font></td>
				<td>
					<input type="radio" name="sysStatus" id="sysStatus_1" value="1" />启用
					<input type="radio" name="sysStatus" id="sysStatus_0" value="0" />停用
				</td>
			</tr>
			<tr>
				<td class="datagrid-header"></td>
				<td>	
					<a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="$('#inputForm').submit();">提交</a>	
					<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="parent.colseAdd();"; >取消</a>	
				</td>
			</tr>
		</table>
	</form>
</body>
</html>

<script>
function initRadio(elemname,selVl){
	var myobj=document.getElementsByName(elemname);
	for ( var i = 0; i < myobj.length; i++) {
		if (myobj[i].value == selVl) {
			myobj[i].checked = "true";
		}
	}
 }
initRadio("sysStatus","${item.sysStatus}");
</script>